<template>
  <div class="login">
    <van-cell-group inset >
  <!-- 输入手机号，调起手机号键盘 -->
  <van-field v-model="tel" type="tel" label="手机号" />
  <!-- 输入密码 -->
  <van-field v-model="password" type="password" label="密码" />
</van-cell-group>
<van-button type="primary" block @click="login(tel,password)">登录</van-button>
<router-link to="/register">去注册</router-link>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
//import { acountLogin } from '@/api/login';
import { showNotify } from 'vant';
import router from '@/router';
import useUserStore from '../../store/modules/user'


const store=useUserStore()
const tel = ref('');
const password = ref('');
/* const login=async(tel:any,password:any)=>{
  const result=await acountLogin(tel,password)
  console.log('登录结果',result)
  if(result.data.data.status==200){
    showNotify(result.data.data.message)
    router.push('/mine')

  }

} */
const login=async(tel:any,password:any)=>{
  const result=await store.loginAction(tel,password)
  console.log('store登录结果',result)
  if(result.data.data.status==200){
    showNotify(result.data.data.message)
    router.push('/mine')

  }
  console.log('这是token值',store.token)



}




</script>

<style lang="less" scoped>
.van-cell {
  border: 1px solid gray;
  margin: 10px;


}

</style>
